
[#include "single/layout/layout02/layout.ftl"/]
[@htmlHead]
[/@htmlHead]

[@htmlBody]
<div class="row">
    <ul class="nav nav-tabs">
        <li>
            <a href="${base}/employee/view/index">员工列表</a>
        </li>
        [#if "add"==operateType]
            <li class="active"><a href="javascript:void(0)">员工增加</a></li>
        [#else ]
            <li class="active"><a href="javascript:void(0)">员工编辑</a></li>
        [/#if]

    </ul>

    <div class="col-xs-12 ">

        <form class="form-horizontal" action="${base}/employee/view/update" method="post" id="editForm">
            <input type="hidden" name="id" value="${employee.id}"/>


            <div class="form-group">
                <label class="col-xs-10 col-sm-4   control-label"><span class="required">*</span>归属公司</label>

                <div class="col-xs-10 col-sm-4 ">
                    <div class="input-group ">
                        <input id="companyName" name="companyName" value="${company.name}" placeholder="归属公司" readonly
                               class="form-control "/>
                       <span class="input-group-btn" onclick="component.org.choose('选择公司','companyId','companyName')">
                                <button type="button" class="btn  blue"><i class="fa fa-search"></i></button>
                            </span>
                        <input id="companyId" name="companyId" value="${employee.companyId}" type="hidden"/>

                    </div>
                </div>
            </div>


            <div class="form-group">
                <label class="col-xs-10 col-sm-4  control-label"><span class="required">*</span>归属部门</label>

                <div class="col-xs-10 col-sm-4 ">
                    <div class="input-group input-large">
                        <input id="organizationName" name="organizationName" value="${organization.name}"
                               placeholder="归属部门" readonly
                               class="form-control "/>
                       <span class="input-group-btn"
                             onclick="opOrg()">
                                <button type="button" class="btn  blue"><i class="fa fa-search"></i></button>
                            </span>
                        <input id="organizationId" name="organizationId" value="${employee.organizationId}"
                               type="hidden"/>

                    </div>
                </div>
            </div>


            <div class="form-group">
                <label class="col-xs-10 col-sm-4  control-label"><span class="required">*</span>工号</label>

                <div class="col-xs-10 col-sm-4 ">
                    <input name="no" value="${employee.no}" placeholder="工号"
                           class="form-control input-large" maxlength="20"/>
                </div>
            </div>

            <div id="editAlert" class="" style="min-width:550px"></div>
            <div class="form-group">
                <label class="col-xs-10 col-sm-4  control-label"><span class="required">*</span>姓名</label>

                <div class="col-xs-10 col-sm-4 ">
                    <input name="name" value="${employee.name}" placeholder="姓名"
                           class="form-control input-large"/>
                </div>
            </div>


            <div class="form-group">
                <label class="col-xs-10 col-sm-4  control-label">邮箱</label>

                <div class="col-xs-10 col-sm-4 ">
                    <input name="email" value="${employee.email}" placeholder="邮箱"
                           class="form-control input-large"/>
                </div>
            </div>


            <div class="form-group">
                <label class="col-xs-10 col-sm-4  control-label">电话</label>

                <div class="col-xs-10 col-sm-4 ">
                    <input name="phone" value="${employee.phone}" placeholder="0755-2818133*"
                           class="form-control input-large"/>
                </div>
            </div>


            <div class="form-group">
                <label class=" col-xs-10 col-sm-4  control-label">手机</label>

                <div class="col-xs-10 col-sm-4 ">
                    <input name="mobile" value="${employee.mobile}" placeholder="133329195**"
                           class="form-control input-large"/>
                </div>
            </div>


            <div class="form-group">

                <label class="col-xs-10 col-sm-4  control-label">是否启用</label>

                <div class="col-xs-10 col-sm-4 ">
                    <div class="btn-group" role="group">
                        [#if employee.isEnabled=='0']
                            <button class="btn btn-sm" type="button" value="1">启用</button>
                            <button class="btn btn-success btn-sm" type="button" value="0">禁用</button>
                            <input type="hidden" name="isEnabled" value="0"/>
                        [#else]
                            <button class="btn  btn-success btn-sm" type="button" value="1">启用</button>
                            <button class="btn btn-sm" type="button" value="0">禁用</button>
                            <input type="hidden" name="isEnabled" value="1"/>
                        [/#if]
                    </div>
                </div>
            </div>

        [#--<div class="form-group">--]
        [#--<label class="col-xs-2  col-sm-2control-label">用户类型</label>--]

        [#--<div class="col-sm-4  col-xs-12">--]
        [#--<input name="employeeType" value="${employee.employeeType}" placeholder="用户类型"--]
        [#--class="form-control input-large"/>--]

        [#--</div>--]
        [#--</div>--]



            <div class="form-group">
                <label class="col-xs-10 col-sm-4  control-label">描述</label>

                <div class="col-xs-10 col-sm-4 ">
                    <textarea class="form-control input-large" name="description" id="description"
                              style="text-align: left;">${employee.description}</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class=" col-xs-10 col-sm-4  control-label"></label>

                <div class="col-xs-10 col-sm-4 " align="center">
                    <input type="button" class="btn btn-info btn-sm" value="确定" onclick="doSubmit('${operateType}')"/>
                    <input type="button" onclick="tools.goto('${base}/employee/view/index')"
                           class="btn btn-cancle btn-sm" value="返回"/>
                </div>
            </div>
        </form>
    </div>
</div>

[/@htmlBody]
[@htmlFoot]
<!--validate-->
    [#include "common/validate.ftl"/]
<script src="${jpath}/assets/public/plugins/dialog/bootbox.js" type="text/javascript"></script>
<script src="${base}/plugins/single/js/module/employee/employee.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {

    })
    function opOrg() {
        var companyId = $("#companyId").val();
        if (companyId) {
            component.org.choose('选择部门', 'organizationId', 'organizationName', companyId);
        }
        else  $.messager.alert0({selector: "#editAlert", type: 'warn', html: "请先选择归属公司"});
    }
    if(typeof component == "undefined"||typeof component.org =="undefined"){
        if(typeof component == "undefined"){
            var component={"org":{}};
        }else{
            component.org={};
        }
        component.org.choose=function (title,idField,textField,companyId){
            var url=base+"/organization/view/toTreeList?idField="+idField+"&textField="+textField+"&id="+companyId;
            var buttons={
                btnOk: {
                    label: '确定',
                    callback: function() {
                    }
                },
                btnCancel:{
                    label: '取消',
                    callback: function() {
                    }
                }
            };
            $.messager.dialog({url: url, title: title, buttons: {},iframe:{width:368,height:450}});
        }
    }
</script>
[/@htmlFoot]